﻿@{
    ViewBag.Title = "";
    var id = Model != null ? Model.CityID : 0;
}
@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.WebProvider
@model ZBJF.Warranty.Model.D_City
<ul class="nav nav-tabs">
    <li><a href="/D_City/">城市列表</a></li>
    <li class="active"><a href="/D_City/Edit/@id">@(id > 0 ? "编辑城市" : "添加城市")</a></li>
</ul>
@using (Html.BeginForm("SaveCity", "D_City", FormMethod.Post, new { id = "mvcForm", name = "mvcForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.CityID)
    <div class="control-group">
        <label class="control-label">省份:</label>
        <div class="controls">
            @Html.DropDownListFor(m => m.ProvinceID, ConvertToSelector.Instance.ProvinceConvertToSelectList(), new { validate = "{required:true,messages:{required:'请选择省份'}}" })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">城市名:</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.CityName, new { validate = "{required:true,messages:{required:'请输入城市名'}}" })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">排序:</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.Sort, new { maxlength = 4 })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label"></label>
        <div class="controls">
            <label>
                @Html.CheckBox("Hot", Model != null && Model.Hot)
                是否热门城市
            </label>
            <label>
                @Html.CheckBoxFor(m => m.IsAvailable)
                是否可用
            </label>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">首字母:</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.Letter, new { validate = "{required:true}", maxlength="1" })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">邮编:</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.ZipCode, new { validate = "{required:true}" })
        </div>
    </div>
    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary Edit-R" type="submit" value="提交">
        <input id="btnCancel" class="btn" type="button" value="重置" onclick="reset()">
    </div>
}
@section scripts{
    <script>
        function reset() {
            document.getElementById("mvcForm").reset();
        }
    </script>
}